/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.game.math.view.action
import javax.swing.AbstractAction;
import javax.swing.JFrame;
import java.util.ResourceBundle;
import java.awt.event.ActionEvent;
import org.game.math.view.PrimaryMathAboutBox;
import org.game.math.view.PrimaryMathApp;
class ShowAboutBox(name:String) extends AbstractAction(name) {
  var aboutBox:PrimaryMathAboutBox = null;
  def this() = {
    this(ShowAboutBox.bundle.getString("item.menu.name"));
  }

  override def actionPerformed(ae:ActionEvent):Unit = {
    if (aboutBox == null) {
      val mainFrame:JFrame = PrimaryMathApp.getApplication().getMainFrame();
      aboutBox = new PrimaryMathAboutBox(mainFrame);
      aboutBox.setLocationRelativeTo(mainFrame);
    }
    PrimaryMathApp.getApplication().show(aboutBox);
  }
}

object ShowAboutBox {
  private val bundle:ResourceBundle = ResourceBundle.getBundle("org.game.math.view.action.ShowAboutBox");
}